package com.gp.controller;

import com.github.pagehelper.PageInfo;
import com.gp.entity.Role;
import com.gp.entity.SysOperLog;
import com.gp.entity.User;
import com.gp.service.LogService;
import com.gp.util.CommonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 来一杯凉咖
 * @create 2022/3/11 13:02
 */
@RestController
@RequestMapping("/system")
public class OperLogController {
    @Autowired
    private LogService logService;
    @GetMapping("/findAllLogs")
    public PageInfo<SysOperLog> findAllLogs(@RequestParam(value = "page",defaultValue = "1")Integer page, @RequestParam(value = "size",defaultValue = "10")Integer size){
        PageInfo<SysOperLog> page1 = logService.getAllLogsForPage(page, size);
        return page1;
    }
    @GetMapping("/delLog")
    public CommonResult delLog(Integer operId){
        return logService.deleteLogById(operId);
    }
    @GetMapping("/selectOper")
    public PageInfo<SysOperLog> selectOper(@RequestParam(value = "page",defaultValue = "1")Integer page, @RequestParam(value = "size",defaultValue = "10")Integer size, String title){
        PageInfo<SysOperLog> logPageInfo = logService.queryLog(page, size,title);
        return  logPageInfo;
    }

}
